<?php
/**
 * Created by PhpStorm.
 * User: WangXiaoHong
 * Date: 15-11-24
 * Time: 下午4:01
 */
include_once('/var/www/html/new/d/module/wxh/nm/fun.class.php');
$txt=file_get_contents("php://input");
include_once ('/var/www/html/new/d/module/wxh/nm/fun.class.php');
err($txt,getip().'|resend','msg_record.txt');
$s = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac1|pw_16u=$pw|auth_16u=true"));
$ac='124625'; //百度糯米接口账号
$pw='a44e45409a99d71088bea2c12314a85c';
$s1=new SoapClient("http://open.12301.cc/openService/MXSE.wsdl",array('encoding' =>'UTF-8','cache_wsdl' => 0));
parse_str($txt,$date);
if(empty($date['custId']) || empty($date['encode'])|| empty($date['time'])  ||
    empty($date['orderId'])|| empty($date['mobile'])||empty($date['thirdOrderId'])){
    $txt='参数错误';
    err($txt,getip(),'resend_fail.txt');
    /****参数错误****/
    cancel_json($status=2);
    exit;
}
$custId = '124625'; //二维码商帐号
$p_encode = 'a44e45409a99d71088bea2c12314a85c'; //二维码商密钥
$time = $date['time']; //获取时间戳
$encode = md5($p_encode.$time.$custId); //加密签名
if($date['encode'] == $encode) //判断签名是否相等
{
    $orderId = $date['orderId'];
    $thirdOrderId =$date['thirdOrderId'];
    $arr= array();
    $cancel_array = array("ac"=>$ac,"pw"=>$pw,"in0"=>$orderId);

    //这里是重发短信程序
    $xml = $s1->__soapCall("reSend_SMS_Global_PL",$cancel_array);
    $result=simpleXML_load_string($xml);
    $str= array();
    try
    {
        if ($result->Rec->UUerrorcode){
            $txt=$orderId.'|'.$result->Rec->UUerrorcode;
            err($txt,getip(),'resend_fail.txt');
            cancel_json($status=2);
        }else{
            $txt=$orderId;
            err($txt,getip(),'resend_success.txt');
            cancel_json($status=0);
        }
    }
    catch (Exception $e)
    {
        echo $e->getMessage();

    }
}else{
    cancel_json($status=3);
}